package com.suray.commin.core.utils;

import org.springframework.beans.BeanUtils;
public class SurayBeanUtils {
    public static <S, T> T copyProperties(S sourceInstance, Class<T> targetClass) {
        if (sourceInstance == null) {
            return null;
        }
        if (targetClass == null) {
            return null;
        }
        try {
            T targetInstance = targetClass.newInstance();
            BeanUtils.copyProperties(sourceInstance, targetInstance);
            return targetInstance;
        } catch (Exception e) {
            return null;
        }
    }
}
